//
//  MineHomePageViewController.m
//  littleLight's Project-A
//
//  Created by dllo on 16/5/27.
//  Copyright © 2016年 light. All rights reserved.
//

#import "MineHomePageViewController.h"
#import "loginViewController.h"
#import "CollectViewController.h"
@interface MineHomePageViewController ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView *myTableView;
@property (nonatomic, strong) NSMutableArray *myArray;
@property (nonatomic, strong) UIButton *headButton;


@end

@implementation MineHomePageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.myArray = [NSMutableArray array];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"登入" style:UIBarButtonItemStylePlain target:self action:@selector(loginAction)];
    
    self.myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    self.myTableView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.myTableView];
    [self.myTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"reuse"];
    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
    
    
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 250)];
    imageV.image = [UIImage imageNamed:@"wodetoushitu"];
    self.myTableView.tableHeaderView = imageV;
    
    self.myArray = [NSMutableArray arrayWithObjects:@"我的收藏",@"清除缓存",@"夜间模式", nil];
    self.headButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.headButton.frame = CGRectMake(self.view.frame.size.width / 2 - 50, 30, 100, 100);
    self.headButton.backgroundColor = [UIColor whiteColor];
    self.headButton.layer.masksToBounds = YES;
    self.headButton.layer.cornerRadius = 50;
    [imageV addSubview:self.headButton];
    
    
    
}

- (void)loginAction
{
    loginViewController *vc = [[loginViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
    
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 3;
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuse"];
    cell.textLabel.text = self.myArray[indexPath.row];
    
    
    return cell;
}

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        CollectViewController *collectVC = [[CollectViewController alloc] init];
        [self.navigationController pushViewController:collectVC animated:YES];
        
        
    }

}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
